package com.yanqu.road.server.cmd.skin;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.skin.SkinProto;
import com.yanqu.road.pb.skinvolume.SkinVolumeProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.player.SkinVolumeModule;
import com.yanqu.road.server.gameplayer.module.skin.SkinModule;
import com.yanqu.road.server.manger.config.SkinMgr;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.GameProtocol;

@Cmd(code = GameProtocol.S_SKIN_PATRONS_BOND_ACTIVE, desc = "激活单个羁绊")
public class SkinPatronsBondActiveCmd extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        SkinProto.UserPatronsSkinBondActiveReqMsg reqMsg = SkinProto.UserPatronsSkinBondActiveReqMsg.parseFrom(packet.getBytes());
        ret = player.getModule(SkinModule.class).activePatronsSkinBond(reqMsg.getCombId(), reqMsg.getSkinIdList());
    }

    @Override
    public void sendData(GamePlayer player) {
        if (0 != ret) {
            player.sendPacket(ClientProtocol.U_SKIN_PATRONS_BOND_ACTIVE, SkinProto.UserPatronsSkinBondActiveRespMsg.newBuilder().setRet(ret));
        }

    }
}
